//#include "StdAfx.h"
#include "BasicAddress.h"

namespace utility
{
	BasicCommunicationAddress::BasicCommunicationAddress(void)
	{
		// lcy note 2008_10_10:
		m_strDomain = "";
		m_strIp     = "";
		m_uPort     = 0;
		m_cIpType   = 4;
	}
	BasicCommunicationAddress::BasicCommunicationAddress( const BasicCommunicationAddress & addr )
	{
		m_cIpType   = addr.m_cIpType;
		m_cNetType  = addr.m_cNetType;
		m_uPort     = addr.m_uPort;
		m_strIp     = addr.m_strIp;
		m_strDomain = addr.m_strDomain;
	}
	BasicCommunicationAddress::~BasicCommunicationAddress(void)
	{
	}
	bool BasicCommunicationAddress::operator==( const BasicCommunicationAddress & addr )
	{
		bool bRes = ( (m_strIp==addr.m_strIp) && (m_uPort==addr.m_uPort) );
		return bRes;
	}
	BasicCommunicationAddress & BasicCommunicationAddress::operator=( const BasicCommunicationAddress & addr )
	{
		this->m_cIpType   = addr.m_cIpType;
		this->m_cNetType  = addr.m_cNetType;
		this->m_uPort     = addr.m_uPort;
		this->m_strIp     = addr.m_strIp;
		this->m_strDomain = addr.m_strDomain;
		return *this;
	}
	void BasicCommunicationAddress::SetPortEx( uint16 uPort )
	{
		m_uPort = uPort;
	}
	void BasicCommunicationAddress::SetNetType( uint8 cNetType )
	{
		m_cNetType = cNetType;
	}
	void BasicCommunicationAddress::SetIpType( uint8 cIpType )
	{
		m_cIpType = cIpType;
	}
	void BasicCommunicationAddress::SetIp( castr_t lpszIp )
	{
		m_strIp = string(lpszIp);
	}
	void BasicCommunicationAddress::SetDomain( castr_t lpszDomain )
	{
		m_strDomain = lpszDomain;
	}

	uint16 BasicCommunicationAddress::GetPortEx()
	{
		return m_uPort;
	}
	uint8 BasicCommunicationAddress::GetNetType()
	{
		return m_cNetType;
	}
	uint8 BasicCommunicationAddress::GetIpType()
	{
		return m_cIpType;
	}
	castr_t BasicCommunicationAddress::GetIp()
	{
		return m_strIp.c_str();
	}
	castr_t BasicCommunicationAddress::GetDomain()
	{
		return m_strDomain.c_str();
	}
}
